<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>通讯录</title>
    <style>
        h1{ color:red;}
        table{
            border: 5px double red;
            width: 500px;
        }
        th{ color:red; }
        th, td{
            border-bottom: 1px dotted red;
            border-right: 1px dotted red;
            padding: 8px;
        }
    </style>

</head>
<body>
<h1>我的通讯录1</h1>
<?php
$db=new PDO('mysql:host=localhost;dbname=db','root','12qwas');
$ps=$db->query("select * from students order by xh");
echo "<table>";
echo "<tr><th>学号</th><th>姓名</th><th>手机</th></tr>";
while($r=$ps->fetch(PDO::FETCH_ASSOC)){
    echo "<tr><td>{$r['xh']}</td><td>{$r['xh']}</td><td>{$r['xh']}</td></tr>";
}
echo "</table>";
?>
</body>
</html>